package com.wangy.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * *@Author yyzb
 * *@Date 2024/10/23 17:54
 * *@Version 1.0
 */

@Mapper
public interface UserRoleMapper {

    @Delete("delete from user_role where user_id = #{id}")
    void deleteByUserId(Long id);

    @Select("select role_id from user_role where user_id = #{userId}")
    Long getRoleIdByUserId(Long userId);

    void addUserIdRoleIdRelationship(Long userId, Long roleId);

    @Delete("delete from user_role where role_id = #{roleId}")
    void deleteByRoleId(Long roleId);
}
